// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
// 使用自己配置好的axios
import Axios from './axios/normalAxios';
import AxiosFrom from './axios/formAxios';
// 替换vue本来的http模块
Vue.prototype.$http = Axios;
Vue.prototype.$http1 = AxiosFrom;
//vuex
import store from './store/index'
Vue.config.productionTip = false

//使用base64位加密
import Base64 from './utils/base64'
Vue.prototype.$Base64 = Base64;

import myStorage from './utils/storage'
Vue.prototype.$Storage = myStorage;

//图片过滤器
Vue.filter("img", (val) => {
  return /^http/.test(val) ? val : ["http://www.baidu.com/" + val];
})
//对手机号进行*加密
Vue.filter("Phone", (item) => {
  return `${item}`.replace(/(\d{3})(\d{4})(\d{4})/, "$1****$3");
})

//时间戳转换
Vue.filter('dateFormat', (dateStr, pattern = "YYYY-MM-DD HH:mm:ss") => {
  if (dateStr == 0) {
    return "2021-04-11 13:14:52"
  } else {
    return moment(dateStr).format(pattern)
  }
})

new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
